package com.tianji.promotion.mapper;

import com.tianji.promotion.domain.po.Coupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 优惠券的规则信息 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2025-04-18
 */
public interface CouponMapper extends BaseMapper<Coupon> {

    @Update("update coupon SET issue_num = issue_num + 1 WHERE id = #{couponId} and total_num > issue_num ")
    int incrIssueNum(Long id);

    List<Coupon> queryMyCoupons(Long userId);
}
